<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<style>

</style>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
                <?php include "../public_flow/flow_show_optbut.php";?>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">

        <div><?php include "../public_flow/flow_show_info.php";?></div>


        <div class="table-box tablenes">
            <div class="title"><span>基本信息</span><span onclick="go_to_engin_xiang()" class="colorlan" style="float: right;margin-right: 12px">查看工程概况</span></div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">工程名称</td><td id="enginname" class="tv colorlan"></td><td class="tt">工程编号</td><td id="engin_number" class="tv"></td></tr>
                <tr><td class="tt">业务归属</td><td id="engin_gui_unit_name" class="tv"></td><td class="tt">工程管理文件汇编</td><td id="engin_neiname" class="tv colorlan"></td></tr>
                <tr><td class="tt">工程负责人</td><td id="engin_gofuer" class="tv"></td><td class="tt">工程负责人联系电话</td><td id="engin_gofutel" class="tv"></td></tr>
                <tr><td class="tt">中标价/合同价(元)</td><td id="engin_shimoney" class="tv"></td><td class="tt">工程结算金额(元)</td><td id="engin_shijiefee" class="tv"></td></tr>
                </tbody>
            </table>
        </div>

        <div class="table-box tablenes jclkzc">
            <div class="title">本工程回款资金池信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">本工程累计回款金额(元)</td><td id="engin_hougonghuimoney" class="tv"></td><td class="tt">累计回款金额占比(%)</td><td id="engin_leihuibi" class="tv"></td></tr>
                <tr><td class="tt">本工程回款累计支付(元)</td><td id="engin_hougongzhimoneyquben" class="tv"></td><td class="tt">本工程回款累计收取(元)</td><td id="engin_hougonghuikoufee" class="tv"></td></tr>
                <tr><td class="tt">本工程预留金额(元)</td><td id="engin_jiedongkoufee" class="tv"></td><td class="tt">本工程回款可用余额(元)</td><td id="engin_gonghui_keyu" class="tv"></td></tr>
                </tbody>
            </table>
        </div>

        <div class="table-box tablenes jclkzc" id="last_kou_dom">
            <script type="text/html" id="toolbarDemo_last_kou_list">最近一次收取信息</script>
            <div class="tableShow">
                <table id="datalist_last_kou_list" lay-filter="datalist_last_kou_list"></table>
            </div>
        </div>



        <div class="table-box tablenes">
            <div class="title">本次付款信息</div>
            <table class="layui-table">
                <tbody>
                <tr><td class="tt">付款类型</td><td class="tv" id="fulei" colspan="3"></td></tr>
                <tr><td class="tt">款项摘要</td><td id="zhai" class="tv"></td><td class="tt">本次付款合计(元)</td><td id="money" class="tv"></td></tr>
                <tr><td class="tt">备注</td><td class="tv" id="explain" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>


        <div><?php include "../public/upinfo_show.php";?></div>

        <div><?php include "../public_flow/flow_show_flowrelas.php";?></div>

        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo">付款明细</script>
            <div class="tableShow">
                <table id="datalist" lay-filter="datalist"></table>
            </div>
        </div>


        <div><?php include '../public_flow/flow_show_shenlog.php'?></div>
        <div><?php include '../public_flow/flow_show_talk.php'?></div>
        <div><?php include '../public/opt_browse.php'?></div>
    </div>
</div>
<script>
    var param_id = getQueryVariable('id') || 0;
    var pub_enginid;
    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_hou_gongzhi_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var engininfo = res.data.engininfo;

                if(engininfo){
                    pub_enginid = engininfo.id
                    $("#enginname").text(engininfo.name).click(function () {
                        openPage('../engin/show.php?id='+engininfo.id);
                    });
                    $('#engin_number').text(engininfo.number);
                    $('#engin_gui_unit_name').text(engininfo.gui_unit_name);
                    $('#engin_gofuer').text(engininfo.gofuer);
                    $('#engin_gofutel').text(engininfo.gofutel);
                    if(engininfo.neiinfo){
                        $("#engin_neiname").text(engininfo.neiinfo.name).click(function () {
                            openPage('../contract_nei/show.php?id='+engininfo.neiinfo.id);
                        });
                    }
                    if(engininfo.shiinfo){
                        $('#engin_shimoney').text(parseFormatNum(engininfo.shiinfo.money));
                    }
                    $('#engin_shijiefee').text(parseFormatNum(engininfo.shijiefee));

                    $('#engin_hougonghuimoney').text(parseFormatNum(engininfo.hougonghuimoney));
                    $('#engin_leihuibi').text(engininfo.leihuibi);
                    $('#engin_hougongzhimoneyquben').text(parseFormatNum(engininfo.hougongzhimoneyquben));
                    $('#engin_hougonghuikoufee').text(parseFormatNum(engininfo.hougonghuikoufee));
                    $('#engin_jiedongkoufee').text(parseFormatNum(engininfo.jiedongkoufee));
                    $('#engin_gonghui_keyu').text(parseFormatNum(engininfo.gonghui_keyu));

                    var gofuerxianginfoList = table.render({
                        elem: "#datalist_gofuerxianginfo",data:engininfo.gofuerxianginfo, toolbar: '#toolbarDemo_gofuerxianginfo', page: false
                        ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                        ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                        ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                        , cols: [[
                            {type:'numbers',title:'序号'}
                            ,{field: 'name', title: '工程名称'}
                            ,{field: 'hougonghuimoney', title: '累计工程回款(元)'}
                            ,{field: 'hougongzhimoneyquben', title: '累计工程付款(元)'}
                            ,{field: 'hougonghuikoufee', title: '累计已收取(元)'}
                            ,{field: 'hougonghuikeyong', title: '工程回款可用余额(元)'}
                        ]]
                        , done: function (res) {
                            soulTable.render(this);
                        }
                    });
                }


                $("#money").text(parseFormatNum(data.money));
                $("#zhai").text(data.zhai);
                $("#fulei").text(data.fulei);
                $("#explain").text(data.explain);


                if(data.fulei == '仅材料款支付'){
                    $(".jclkzc").addClass('layui-hide');
                }


                var mytableList = table.render({
                    elem: "#datalist",data:res.data.list, toolbar: '#toolbarDemo', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号'}
                        ,{field: 'zhikuanlei_name', title: '款项类型'}
                        ,{field: 'fuer', title: '付款对象'}
                        ,{field:'gongzhifee',title:'已付款累计(元)',templet: function(d){
                                return parseFormatNum(d.gongzhifee);
                            }}
                         ,{field:'piaoshoufee',title:'已收进项发票累计(元)',templet: function(d){
                                return parseFormatNum(d.piaoshoufee);
                            }}
                         ,{field:'concaimoney',title:'已签采购合同累计(元)',templet: function(d){
                                return parseFormatNum(d.concaimoney);
                            }}
                        ,{field: 'caiid_name', title: '本次支付关联采购合同'}
                         ,{field:'money',title:'本次付款金额(元)',templet: function(d){
                                return parseFormatNum(d.money);
                            }}
                        ,{field: 'moneyshuo', title: '资金渠道及金额'}
                        ,{field: 'incdaotype_name', title: '支付方式'}
                        ,{field: 'bankzhang', title: '账户名称'}
                        ,{field: 'banknum', title: '账号'}
                        ,{field: 'bankname', title: '开户行'}
                        ,{field: 'explain', title: '款项说明'}
                         ,{field:'difee',title:'本次支付占用进项票金额(元)',templet: function(d){
                                return parseFormatNum(d.difee);
                            }}
                        ,{field:'',title:'支付状态',templet: function(d){
                                if(d.kuaninfo){return d.kuaninfo.paystate_name;}
                                return '';
                            }}
                        ,{field:'',title:'已支付金额(元)',templet: function(d){
                                if(d.kuaninfo){
                                    return '<span class="colorlan" onclick="openNavPage(\'查看交易明细信息\',\'account_list/index.php?kuanid='+d.kuaninfo.id+'\')">'+parseFormatNum(d.kuaninfo.payfee)+'</span>';
                                }
                                return '';
                            }}
                        ,{field:'',title:'未支付金额(元)',templet: function(d){
                                if(d.kuaninfo){return parseFormatNum(d.kuaninfo.paynofee)}
                                return '';
                            }}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });


                var last_kou_list_list = table.render({
                    elem: "#datalist_last_kou_list",data:res.data.last_kou_list, toolbar: '#toolbarDemo_last_kou_list', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号'}
                        ,{field: 'name', title: '收取款项类型'}
                        ,{field: 'enginname', title: '费用所属工程名称'}
                        ,{field:'koufee',title:'收取金额(元)',templet: function(d){
                                return parseFormatNum(d.koufee);
                            }}
                        ,{field: 'shoubiao', title: '收取标准'}
                        ,{field: 'explain', title: '款项说明'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });




                public_flow_show_display(res.data.billinfo);
                public_upload_show_file('upload_files', res.data.files);
                render_from();
            }
        });

        public_get_readsandlog('hou_gongzhi', param_id);
    });


    function go_to_engin_xiang(){
        if(pub_enginid){
            openPage('../engin/xiang.php?id='+pub_enginid);

        }else{
            facade.error("暂无工程信息");return false;
        }
    }
</script>
</body>
</html>




